
module LanguageCompilerCommon where
import LanguageParser
import LanguageTransform
import LanguageGenerator
import System
import Data.List
import Debug.Trace
import Control.Monad.Error

transform' = convertResult.transform
    where
        convertResult (Left msg) = Left (msg "")
        convertResult (Right x) = Right x

compileString source = do
    node <- parseString source
    node' <- transform' node
    return $ generate node' 


compileStringWithHeader :: String -> String -> Either String ShowS
compileStringWithHeader header source = do
    node <- parseString source
    node' <- transform' node
    return $ generateWithHeader header node'         
